<?php

/**
* LogoutModule.class.php
*
* Create Logout link
*
* @author     Blazej Zieba <b@zieba.info>
* @copyright  2007 konekto.com
* @version    CVS: $Id:$
*/

require_once("framework/PageModule.class.php");
require_once 'framework/AuthSingleton.php';



// {{{ LogoutModule

class LogoutModule extends PageModule 
{
    // {{{ Class operations 

    // {{{ LogoutModule
    /**
    * C'tor
    */
    function LogoutModule()
    {
        trigger_error("ENTER LogoutModule::LogoutModule()", E_USER_NOTICE);
    }
    // }}}
    // {{{ getContent

    /**
    * Function returns page content
    *
    */

    function getContent()
    {

        trigger_error("ENTER LogoutModule::getContent()", E_USER_NOTICE);
        
        $tpl = new HTML_Template_IT("./templates");
        $tpl->loadTemplatefile("logout.tpl.xhtml",true,true);
        
        if ( AuthSingleton::instance('AUTH_USER')->getAuth() )
        {
            $global = &PEAR::getStaticProperty('CONFIG_INI','GLOBAL');
            $tpl->setCurrentBlock("static") ;    
            $tpl->setVariable("TITLE", _('Logout')) ;
            $tpl->setVariable("LINK", rtrim($global['service_url'],'/')."/?logout=1") ;
            $tpl->parseCurrentBlock() ;
        }
        trigger_error("LEAVE LogoutModule::getContent()", E_USER_NOTICE);
        return $tpl->get(); 

    }
    
    // }}}

    // }}}
}

// }}} 

?>
